package com.changgou.search.pojo;

import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import javax.persistence.Id;
import java.io.Serializable;
import java.util.Date;
import java.util.Map;

@Document(indexName = "skuinfo",type = "docs") //indexName="skuinfo" 索引相当于建立个数据库
public class SkuInfo implements Serializable {

        //商品id，同时也是商品编号
        @Id
        @Field(index = true, store = true, type = FieldType.Keyword)
        private Long id;

        //SKU名称
        @Field(index = true, store = true, type = FieldType.Text, analyzer = "ik_smart")
        private String name;

        //商品价格，单位为：元
        @Field(index = true, store = true, type = FieldType.Double)
        private Long price;

        //库存数量
        @Field(index = true, store = true, type = FieldType.Integer)
        private Integer num;

        //商品图片
        @Field(index = false, store = true, type = FieldType.Text)
        private String image;

        //商品状态，1-正常，2-下架，3-删除
        @Field(index = true, store = true, type = FieldType.Keyword)
        private String status;

        //创建时间
        private Date createTime;

        //更新时间
        private Date updateTime;

        //是否默认
        @Field(index = true, store = true, type = FieldType.Keyword)
        private String isDefault;

        //SPUID
        @Field(index = true, store = true, type = FieldType.Long)
        private Long spuId;

        //类目ID
        @Field(index = true, store = true, type = FieldType.Long)
        private Long categoryId;

        //类目名称
        @Field(index = true, store = true, type = FieldType.Keyword)
        private String categoryName;

        //品牌名称
        @Field(index = true, store = true, type = FieldType.Keyword)
        private String brandName;

        //规格
        private String spec;

        //规格参数
        private Map<String, Object> specMap;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Long getPrice() {
        return price;
    }

    public void setPrice(Long price) {
        this.price = price;
    }

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getIsDefault() {
        return isDefault;
    }

    public void setIsDefault(String isDefault) {
        this.isDefault = isDefault;
    }

    public Long getSpuId() {
        return spuId;
    }

    public void setSpuId(Long spuId) {
        this.spuId = spuId;
    }

    public Long getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }

    public String getBrandName() {
        return brandName;
    }

    public void setBrandName(String brandName) {
        this.brandName = brandName;
    }

    public String getSpec() {
        return spec;
    }

    public void setSpec(String spec) {
        this.spec = spec;
    }

    public Map<String, Object> getSpecMap() {
        return specMap;
    }

    public void setSpecMap(Map<String, Object> specMap) {
        this.specMap = specMap;
    }

}
